package CollegeInformation;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBUtil {

    private static final String URL = "jdbc:mysql://localhost:3306/data02";//数据库地址
    private static final String user = "root";//用户名
    private static final String password = "123456";//密码
    private static final String DRIVER = "com.mysql.cj.jdbc.Driver";//驱动

    public static Connection connection() throws Exception {
        Class.forName(DRIVER); //加载数据库驱动
        return DriverManager.getConnection(URL,user,password);
    }
}

